//
//  DetailCarViewController.m
//  LoveCar
//
//  Created by Xue Senhong on 15/5/23.
//  Copyright (c) 2015年 薛森鸿. All rights reserved.
//

#import "DetailCarViewController.h"

@interface DetailCarViewController ()

@end

@implementation DetailCarViewController

- (void)dealloc
{
    [_cellModel release];
    [_detailModel release];
    [super dealloc];
}
- (instancetype)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        self.detailModel = [[[ListModel alloc] init] autorelease];
        self.cellModel = [[[SecondCellModel alloc] init] autorelease];
    }
    return self;
}
-(void)loadView
{
    [super loadView];
    
    if (self.detailModel.ZID != nil) {
        
        NSString *html = [NSString stringWithFormat:@"http://api.ycapp.yiche.com/huimaiche/getserialprice?serialid=%@&cityid=201", self.detailModel.ZID];
        
        [SANetWorkingTask request:html parmater:nil block:^(NSDictionary *result) {
            
            NSDictionary *dic = [result objectForKey:@"data"];
            
            NSString *str = [dic objectForKey:@"link"];
            
            UIWebView *webView = [[UIWebView alloc] initWithFrame:self.view.frame];
            
            NSURL *url = [NSURL URLWithString:str];
            
            NSURLRequest *request = [NSURLRequest requestWithURL:url];
            
            [webView loadRequest:request];
            
            [self.view addSubview:webView];
            
            [webView release];
        }];
        
    } else {
        NSString *html = [NSString stringWithFormat:@"http://api.ycapp.yiche.com/huimaiche/getserialprice?serialid=%@&cityid=201", self.cellModel.serialId];
        
        [SANetWorkingTask request:html parmater:nil block:^(NSDictionary *result) {
            
            NSDictionary *dic = [result objectForKey:@"data"];
            
            NSString *str = [dic objectForKey:@"link"];
            
            UIWebView *webView = [[UIWebView alloc] initWithFrame:self.view.frame];
            
            NSURL *url = [NSURL URLWithString:str];
            
            NSURLRequest *request = [NSURLRequest requestWithURL:url];
            
            [webView loadRequest:request];
            
            [self.view addSubview:webView];
            
            [webView release];

        }];
    }
    
}







- (void)viewDidLoad {
    [super viewDidLoad];
}


@end
